<template>
  <div style="height: 100%; width: 100%; position: relative" ref="maindev">
      <div class="pagetop">
          <div style="width: 100%">
              <table style="font-size: 12px; white-space: nowrap" border="0" class="table1style">
                  <tr>
                      <td align="right" class="tdpadding"> <el-dropdown @command="handleCommand" style="font-size: 12px;">
                              <u class="el-dropdown-link">
                                  {{ datename }}
                              </u>
                              <el-dropdown-menu slot="dropdown">
                                  <el-dropdown-item command="上报时间">
                                      <font font-size="12px">上报时间</font>
                                  </el-dropdown-item>
                                  <el-dropdown-item command="标本日期">
                                      <font font-size="12px">标本日期</font>
                                  </el-dropdown-item>
                              </el-dropdown-menu>
                          </el-dropdown></td>

                      <td style="width: 280px" v-if="datename=='上报时间'">
                          <el-date-picker v-model="search_startdate" :clearable="false" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" style="width: 176px" :picker-options="pickerOptions"> </el-date-picker>
                          至
                          <el-date-picker v-model="search_enddate" type="datetime" :clearable="false" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" style="width: 176px" :picker-options="pickerOptions"> </el-date-picker>
                      </td>
                      <td style="width: 280px" v-else>
                          <el-date-picker v-model="sample_startdt" :able="false" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 47%; min-width: 100px" :picker-options="pickerOptions" :clearable="false" :key="startkey"> </el-date-picker>至 <el-date-picker v-model="sample_enddt" type="date" :able="false" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 46%; min-width: 100px" :picker-options="pickerOptions" :clearable="false" :key="endkey"> </el-date-picker>
                      </td>
                      <td align="right" class="tdpadding">检验科室</td>
                      <td>
                          <rm-ddl-common datatype="labdept" dataname="检验科室" v-model="search_labdeptval" width="100%" @change="labdeptChange">
                          </rm-ddl-common>
                      </td>
                      <td align="right" class="tdpadding">危急值分类</td>
                      <td>
                          <el-select v-model="search_alertkind" style="width: 100%" placeholder="请选择或双击开窗" @dblclick.native="popMultipleChk(search_alertkind, 'search_alertkind', alertkind, '危急值分类选择')" clearable>
                              <el-option v-for="item in alertkind" :key="item.data" :label="item.display" :value="item.data"></el-option>
                          </el-select>
                      </td>
                      <td align="right" class="tdpadding">科室</td>
                      <td style="width: 200px">
                          <rm-ddl-common datatype="dept" dataname="科室" v-model="search_deptcode" @change="deptChange"></rm-ddl-common>
                      </td>
                      <td style="width: 200px" class="tdpadding">
                          <el-checkbox true-label="1" false-label="0" v-model="search_islabbill">剔除实验室开单
                          </el-checkbox>
                      </td>

                      <td></td>
                      <td style="width: 80px">
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_req_deptno" @change="chkevent($event, 'chk_req_deptno', '科室')">科室</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_alerttype" @change="chkevent($event, 'chk_alerttype', '警告类别')">警告类别</el-checkbox>
                      </td>
                      <td style="width: 80px">
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_sendhospcode" @change="chkevent($event, 'chk_sendhospcode', '送检医院')">送检医院</el-checkbox>
                      </td>

                      <td style="width: 40px">
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_years" @change="chkevent($event, 'chk_years', '年')">年</el-checkbox>
                      </td>
                      <td></td>
                  </tr>
                  <tr>
                      <td align="right">报告单元</td>
                      <td>
                          <rm-ddl-rptunit prgno="LIS440" v-model="search_rptunit" width="100%" clearable @change="rptunitChange">
                          </rm-ddl-rptunit>
                      </td>
                      <td align="right">检验组</td>
                      <td>
                          <rm-ddl-common v-model="search_labgroupid" clearable filterable :appendtobody="true" visible-change:true datatype="labgroup" dataname="检验组" width="100%" @change="labgroupChange"></rm-ddl-common>
                      </td>
                      <td align="right">病区</td>
                      <td>
                          <rm-ddl-common datatype="ward" dataname="病区" v-model="search_wardno" width="100%" @change="wardChange">
                          </rm-ddl-common>
                      </td>
                      <td align="right">病人类型</td>
                      <td>
                          <div width="140px" style="float: left">
                              <rm-ddl-common datatype="seccode" kindno="PT" dataname="病人类型" v-model="search_pattype" key="pt" width="140px" @change="pattypeChange"></rm-ddl-common>
                          </div>
                          <el-checkbox true-label="1" false-label="0" v-model="search_isreject" style="padding-left: 10px; top: 5px">剔除</el-checkbox>
                      </td>
                      <td class="tdpadding">
                          <el-checkbox true-label="1" false-label="0" v-model="search_isbarcodenull">剔除无条码数据
                          </el-checkbox>
                      </td>
                      <td></td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_req_wardno" @change="chkevent($event, 'chk_req_wardno', '病区')">病区</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_report_user" @change="chkevent($event, 'chk_report_user', '检验医生')">检验医生</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_ckhospcode" @change="chkevent($event, 'chk_ckhospcode', '检验院区')">检验院区</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_months" @change="chkevent($event, 'chk_months', '月')">月</el-checkbox>
                      </td>
                  </tr>
                  <tr>
                      <td align="right">送检医院</td>
                      <td>
                          <rm-ddl-common datatype="hospital" dataname="送检医院" v-model="search_sendhospcode" width="100%" @change="sendhospChange"></rm-ddl-common>
                      </td>
                      <td align="right">报告项目</td>
                      <td>
                          <rm-ddl-rptitem v-model="search_rpt_itemcode" width="100%" @change="rptitemChange"></rm-ddl-rptitem>
                      </td>
                      <td align="right">单元组合</td>
                      <td>
                          <el-select v-model="search_unitgroup" @dblclick.native="popMultipleChk(unitgroup, 'unitgroup', rptunitGroupOption, '单元组合选择')" style="width: 100%" filterable clearable>
                              <el-option v-for="(item, index) in rptunitGroupOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                          </el-select>
                      </td>
                      <td align="right">检验医院</td>
                      <td>
                          <rm-ddl-common datatype="hospital" dataname="检验医院" v-model="search_chkhospcode" width="100%" @change="chkhospChange"></rm-ddl-common>
                      </td>
                      <td class="tdpadding">
                          <el-checkbox true-label="1" false-label="0" v-model="search_ispatcodenull">剔除无病人号
                          </el-checkbox>
                      </td>

                      <td></td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_emerflagname" @change="chkevent($event, 'chk_emerflagname', '急诊')">急诊</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_req_docno" @change="chkevent($event, 'chk_req_docno', '送检医生')">送检医生</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_labgroupid" @change="chkevent($event, 'chk_labgroupid', '检验组')">检验组</el-checkbox>
                      </td>
                  </tr>
                  <tr></tr>
                  <tr>
                      <td class="tdpadding" colspan="2">
                          <!-- 警告类别 -->
                          <el-radio-group v-model="search_alerttype">
                              <table>
                                  <tr>
                                      <td>
                                          <el-radio label="">全部</el-radio>
                                      </td>
                                      <td>
                                          <el-radio label="0">危急值</el-radio>
                                      </td>
                                      <td>
                                          <el-radio label="1">多重耐药菌</el-radio>
                                      </td>
                                      <td>
                                          <el-radio label="2">血培养阳性</el-radio>
                                      </td>
                                  </tr>
                              </table>
                          </el-radio-group>
                      </td>
                      <td align="right">上报超过</td>
                      <td>
                          <el-input v-model="search_sendminute" class="divwidth"></el-input>分钟
                      </td>
                      <td align="right">处理超过</td>
                      <td>
                          <el-input v-model="search_dealminute" class="divwidth"></el-input>分钟
                      </td>
                      <!-- <td align="right">电话通知超过</td> 
                      <td><el-input v-model="search_phoneminute" class="divwidth"></el-input>分钟</td>-->
                      <td>内部处理超过</td>
                      <td>
                          <el-input v-model="search_insideminute" class="divwidth"></el-input>分钟
                      </td>
                      <td class="tdpadding">
                          <!-- <el-checkbox true-label="1" false-label="0" v-model="search_iswaitsearch">剔除有待查原因的数据</el-checkbox> -->
                          <el-checkbox true-label="1" false-label="0" v-model="search_isuserdealtime">无确认时间使用处理时间
                          </el-checkbox>
                      </td>
                      <td></td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_rpt_itemname" @change="chkevent($event, 'chk_rpt_itemname', '项目')">项目</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_pat_typecode" @change="chkevent($event, 'chk_pat_typecode', '病人类型')">病人类型</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_rptunitid" @change="chkevent($event, 'chk_rptunitid', '报告单元')">报告单元</el-checkbox>
                      </td>
                  </tr>
                  <tr>
                      <td class="tdpadding" colspan="2">
                          <!-- <el-checkbox true-label="1" false-label="0" v-model="search_isinsidetime">优先使用内部处理时间计算上报超时
                          </el-checkbox> -->
                          <el-checkbox true-label="1" false-label="0" v-model="search_isreportcount">
                              统计上报率时召回数和取消上报数亦视为已上报数</el-checkbox>
                      </td>
                      <td colspan="2">
                          <el-checkbox true-label="1" false-label="0" v-model="search_isshowreport">
                              显示危急值报告数据</el-checkbox>
                      </td>
                      <td align="right">确认超过</td>
                      <td>
                          <el-input v-model="search_confirmminute" class="divwidth"></el-input>分钟
                      </td>
                      <td align="right">复查超过</td>
                      <td>
                          <el-input v-model="search_reviewminute" class="divwidth"></el-input>分钟
                      </td>
                      <!-- <td>内部处理超过</td>
                      <td><el-input v-model="search_insideminute" class="divwidth"></el-input>分钟</td> -->
                      <td class="tdpadding">
                          <el-checkbox true-label="1" false-label="0" v-model="search_isuserconfirmtime">无处理时间使用确认时间
                          </el-checkbox>
                      </td>
                      <td></td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_alertman" @change="chkevent($event, 'chk_alertman', '上报人')">上报人</el-checkbox>
                      </td>
                      <td>
                          <el-checkbox true-label="1" false-label="0" v-model="chklist.chk_alertkind" @change="chkevent($event, 'chk_alertkind', '危急值分类')">危急值分类</el-checkbox>
                      </td>
                  </tr>
                  <tr>
                      <td class="tdpadding" colspan="2">
                          <!-- <el-checkbox true-label="1" false-label="0" v-model="search_isreportcount">
                              统计上报率时召回数和取消上报数亦视为已上报数</el-checkbox> -->
                      </td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td class="tdpadding"></td>
                      <td></td>
                  </tr>
              </table>
              <div class="operation-list">
                  <el-button @click.native="BtnQuery" v-has="'PINQUERY'" type="primary" icon="el-icon-search">查询
                  </el-button>
                  <el-button @click.native="BtnClear" icon="el-icon-close">清除</el-button>
                  <el-button @click.native="BtnExport" icon="el-icon-download">导出</el-button>
              </div>
          </div>
      </div>
      <div class="pagecenter">
          <div class="middle-center">
              <vxe-table :data.sync="tableData" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border height="auto" highlight-current-row class="mytable-style" highlight-hover-column highlight-hover-row how-header-overflow ref="xTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }" header-align="center" :key="xTablekey" show-footer :footer-method="footerMethod" :footer-cell-class-name="footerCellClassName" :loading="xTableLoading" @cell-dblclick="DbClkEvent">
                  <vxe-table-column type="index" title="NO." width="50" header-align="center" align="center">
                  </vxe-table-column>
                  <vxe-table-column :field="items.field" :key="items.field" :title="items.title" :width="items.width" sortable v-for="items in tableColumn" :formatter="formatFun"></vxe-table-column>
                  <vxe-table-column field="report_count" v-if="search_isshowreport == '1'" sortable title="危急值报告总数" width="120" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="repedreport_count" v-if="search_isshowreport == '1'" sortable title="危急值报告通报数" width="120" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="chkreport_count" v-if="search_isshowreport == '1'" sortable title="已审核危急值报告总数" width="140" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="chkrepedreport_count" v-if="search_isshowreport == '1'" sortable title="已审核危急值报告通报数" width="140" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="total_count" sortable title="总数" width="70" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="reped_count" sortable title="上报数" width="85" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.reped_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="reped_rate" sortable title="上报率" width="70" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="cancel_count" sortable title="取消上报数" width="85" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.cancel_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="back_count" sortable title="召回数" width="75" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.back_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="back_rate" sortable title="召回率" width="70" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="rep_timely_count" sortable title="上报及时数" width="85" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.rep_timely_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="rep_untimely_count" sortable title="上报不及时数" width="85" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.rep_untimely_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="rep_timely_rate" sortable title="上报及时率" width="85" header-align="center" align="right"></vxe-table-column>
                  <!-- <vxe-table-column field="phone_count" sortable title="电话通知及时数" width="85" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="phone_rate" sortable title="电话通知及时率" width="85" header-align="center" align="right"></vxe-table-column> -->
                  <vxe-table-column field="confirm_count" sortable title="确认数" width="75" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.confirm_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="unconfirm_count" sortable title="未确认数" width="75" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.unconfirm_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="confirm_rate" sortable title="确认率" width="70" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="confirm_ok_count" sortable title="确认合格数" width="85" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="confirm_ok_rate" sortable title="确认合格率" width="80" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="deal_count" sortable title="处理数" width="75" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.deal_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="undeal_count" sortable title="未处理数" width="75" header-align="center" align="right">
                      <template v-slot="{ row }">
                          <div style="color:blue;cursor:pointer"><u>{{ row.undeal_count }}</u></div>
                      </template>
                  </vxe-table-column>
                  <vxe-table-column field="deal_rate" sortable title="处理率" width="70" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="deal_ok_count" sortable title="处理合格数" width="85" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="deal_ok_rate" sortable title="处理合格率" width="85" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="inconfirm_ok_count" sortable title="内部确认及时数" width="90" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="inconfirm_ok_rate" sortable title="内部确认及时率" width="90" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="review_ok_count" sortable title="复查结果及时数" width="90" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="review_count" sortable title="复查数" width="75" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="review_ok_rate" sortable title="复查及时率" width="85" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="height_count" sortable title="高值项次" width="75" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="low_count" sortable title="低值项次" width="75" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="report_count" sortable title="占报告数" width="75" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="median" sortable title="结果时间中位数" width="95" header-align="center" align="right"></vxe-table-column>
                  <vxe-table-column field="median90" sortable title="结果时间90分位数" width="95" header-align="center" align="right"></vxe-table-column>
              </vxe-table>
          </div>
      </div>

      <!--多选弹窗--->
      <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
          <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog">
          </rm-SqlMultiple>
      </el-dialog>

      <el-dialog :title="detailObj.detailtitle" :visible.sync="detailObj.dialogdetail" width="1000px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :key="editTitlekey">
          <!-- <div style="border:1px solid #CCC">
             <el-form ref="form" :model="inv_purreq_form" label-width="80px">
                  <table style="font-size:12px;white-space: nowrap;" border="0">
                      <tr>
                          <td align="right" style="color:#F56C6C">申请日期</td>
                          <td>
                              <el-date-picker v-model="inv_purreq_form.reqdate" type="date" placeholder="选择日期" style="width:125px" :clearable="false">
                              </el-date-picker>
                          </td>
                          <td align="right" style="color:#F56C6C">申请人</td>
                          <td>
                              <rm-ddl-common @change="reqpersonChange()" datatype="userinfo" dataname="用户" v-model="inv_purreq_form.reqperson" width="90px" :readonly="true" :clearable="false"></rm-ddl-common>
                          </td>
                          <td align=" right" :class="invOption.USELABGROUP=='1'?'must-param':''">检验组</td>
                          <td>
                              <rm-ddl-common datatype="invlabgroup" dataname="检验组" v-model="inv_purreq_form.labgroupid" width="150px" key="2"></rm-ddl-common>
                          </td>
                          <td align=" right">商品组</td>
                          <td>
                              <rm-ddl-common datatype="invitemgroup" dataname="商品组" v-model="inv_purreq_form.itemgroupid" width="150px" key="3" @change="itemgroupidChange"></rm-ddl-common>
                          </td>
                          <td align="right">请购编号</td>
                          <td>
                              <el-input v-model="inv_purreq_form.purreqcode" :disabled="true" style="width:150px"></el-input>
                          </td>

                      </tr>
                    
                  </table>
              </el-form> 
          </div>-->

          <div style="height:400px;width: 100%;margin-top:5px">
              <div style="height:100%">
                  <vxe-table :loading="detailObj.dxloading" :data.sync="detailObj.popTableData" :cell-class-name="PopCellClassName" border fit :mouse-config="{ selected: true }" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" :sort-config="{ trigger: 'cell' }" :keyboard-config="keyConfig" height="auto" header-align="center" highlight-current-row highlight-hover-row ref="popTable" resizable show-header-overflow="tooltip" show-overflow="tooltip" size="mini">
                      <vxe-table-column type="index" title="NO." width="40" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="sampleno" title="样本号" width="80" sortable></vxe-table-column>
                      <vxe-table-column field="sampled_dt" title="采样日期" width="120" sortable></vxe-table-column>
                      <vxe-table-column field="rpt_itemname" title="报告项目" width="150" sortable></vxe-table-column>
                      <vxe-table-column field="rptunitname" title="报告单元" width="100" sortable></vxe-table-column>
                      <vxe-table-column field="alertdt" title="上报时间" width="120" sortable></vxe-table-column>
                      <vxe-table-column field="alertmanname" title="上报人" width="50" sortable header-align="center">
                      </vxe-table-column>
                      <vxe-table-column field="hischeckdt" title="确认时间" width="120" sortable></vxe-table-column>
                      <vxe-table-column field="hischeckmanna" title="确认人" width="50" sortable header-align="center">
                      </vxe-table-column>
                      <vxe-table-column field="hischeckdt1" title="处理时间" width="120" sortable></vxe-table-column>
                      <vxe-table-column field="hischeckman1na" title="处理人" width="50" sortable header-align="center">
                      </vxe-table-column>
                      <vxe-table-column field="pat_name" title="姓名" width="50" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="pat_no" title="病历号" width="50" sortable></vxe-table-column>
                      <vxe-table-column field="pat_typename" title="病人类型" width="70" sortable></vxe-table-column>
                      <vxe-table-column field="pat_sexname" title="性别" width="40" sortable header-align="center">
                      </vxe-table-column>
                      <vxe-table-column field="pat_agestr" title="年龄" width="60" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="req_deptnoname" title="科室" width="80" sortable></vxe-table-column>
                      <vxe-table-column field="req_wardnoname" title="病区" width="80" sortable></vxe-table-column>
                      <vxe-table-column field="req_docnoname" title="开单医生" width="80" sortable></vxe-table-column>
                      <vxe-table-column field="req_bedno" title="床号" width="60" sortable></vxe-table-column>
                      <vxe-table-column field="barcode" title="条码号" width="90" sortable header-align="center">
                      </vxe-table-column>
                      <vxe-table-column field="result_str" title="文本结果" width="70" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="result_num" title="数字结果" width="70" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="result1" title="结果1" width="60" sortable align="right" header-align="center"></vxe-table-column>
                      <vxe-table-column field="result2" title="结果2" width="60" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="result_ref" title="参考值" width="60" sortable align="right" header-align="center"></vxe-table-column>
                      <vxe-table-column field="result_flag" title="结果状态" width="70" sortable align="center" :formatter="formatFun"></vxe-table-column>
                      <vxe-table-column field="descriptions" title="上报备注" width="70" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="hischeckmanname" title="HIS确认人" width="70" sortable align="center" header-align="center"></vxe-table-column>
                      <vxe-table-column field="resultalertid" title="结果ID" width="70" sortable></vxe-table-column>
                      <vxe-table-column field="instrid" title="仪器ID" width="60" sortable align="center">
                      </vxe-table-column>
                      <vxe-table-column field="reportid" title="报告ID" width="150" sortable></vxe-table-column>
                  </vxe-table>
              </div>
          </div>

      </el-dialog>
  </div>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils";
export default {
  name: "LIS642",
  data() {
      const _that = this;
      return {
          chklist: {},
          dialogMultipleVisible: false,
          xTableLoading: false,
          option1: [],
          option2: [],
          fieldname: "",
          tableColumn: [],
          tableData: [],
          tableData1: [],
          xTablekey: 0,
          multichktitle: "",
          pattypeOption: [],
          labdeptOption: [],
          hospOption: [],
          docOption: [],
          hospOption: [],
          deptOption: [],
          wardOption: [],
          rptunitOption: [],
          rptunitGroupOption: [],
          reportcommOption: [],
          labgroupOption: [],
          infocode: "",
          infoitem: "",
          detailObj: {
              detailtitle: "",
              dialogdetail: false,
              popTableData: [],
              dxloading: false,
          },
          //以下为查询条件
          datename: "上报时间",
          daytype: "1",
          search_labdeptval: "", // 检验科室
          search_alertkind: "", // 危急值分类
          alertkind: [
              { display: "A类", data: "A" },
              { display: "B类", data: "B" },
              { display: "C类", data: "C" },
          ],
          search_deptcode: "", //科室
          search_islabbill: "1", //剔除实验室开单
          search_rptunit: "", // 报告单元
          search_labgroupid: "", // 检验组
          search_wardno: "", // 病区
          search_pattype: "", // 病人类型
          search_isreject: "", // 剔除
          search_isbarcodenull: "1", // 剔除无条码数据
          search_sendhospcode: "", // 送检医院
          search_rpt_itemcode: "", // 报告项目
          search_unitgroup: "", // 单元组合
          search_chkhospcode: "", // 检验医院
          search_ispatcodenull: "1", // 剔除 无病人号
          search_alerttype: "", // 警告类别
          search_sendminute: "", // 上报超过
          search_dealminute: "", // 处理超过
          search_phoneminute: "", // 电话通知超过
          search_iswaitsearch: "", // 剔除有待查原因的数据
          search_isinsidetime: "", // 使用内部处理时间
          search_confirmminute: "", // 确认超过
          search_reviewminute: "", // 复查超过
          search_insideminute: "", // 内部处理超过
          search_isuserconfirmtime: "", // 无处理时间使用确认时间
          search_isreportcount: "", // 统计上报数
          search_isshowreport: "", //显示危急值报告数据
          search_isuserdealtime: "", // 无确认时间使用处理时间
          //以下为统计项目
          chklist: {
              chk_req_deptno: false, // 科室
              chk_alerttype: false, // 警告类别
              chk_sendhospcode: false, // 送检医院
              chk_years: false, // 年
              chk_req_wardno: false, // 病区
              chk_report_user: false, // 检验医生
              chk_ckhospcode: false, // 检验医院
              chk_months: false, // 月
              chk_emerflagname: false, // 急诊
              chk_req_docno: false, // 送检医生
              chk_labgroupid: false, // 检验组
              chk_rpt_itemname: false, // 项目
              chk_pat_typecode: false, // 病人类型
              chk_rptunitid: false, // 报告单元
              chk_alertman: false, // 上报人
              chk_alertkind: false, // 危急值分类
          },
          search_startdate: XEUtils.toDateString(new Date(), "yyyy-MM-dd") + " 00:00:00",
          search_enddate: XEUtils.toDateString(new Date(), "yyyy-MM-dd") + " 23:59:59",
          sample_startdt: this.$pub.InitDateTime2(0).datefrom,
          sample_enddt: this.$pub.InitDateTime2(0).dateto,
          chkcnt: 0,
          startkey: 0,
          endkey: 0,
          editTitlekey: 0,
          keyConfig: {},
          pickerOptions: {
              shortcuts: [
                  {
                      text: "今天",
                      onClick(picker) {
                          picker.$emit("pick", new Date());
                          _that.search_startdate = new Date();
                          _that.search_enddate = new Date();
                      },
                  },
              ],
          },
          labdeptname: "",
          deptname: "",
          rptunitname: "",
          labgroupname: "",
          wardname: "",
          pattypename: "",
          sendhospname: "",
          rptitemname: "",
          chkhospname: "",
          exportTableColLen: 0,
      };
  },
  created() {
      this.initOption();
  },
  mounted() {},
  updated() {},
  methods: {
      handleCommand(name) {
          this.datename = name;
          if (name == "上报时间") {
              this.daytype = "1";
          } else if (name == "标本日期") {
              this.daytype = "2";
          }
      },
      DbClkEvent({ row, column }) {
          switch (column.property) {
              case "reped_count":
                  this.detailObj.detailtitle = "明细查看(上报数)";
                  break;
              case "cancel_count":
                  this.detailObj.detailtitle = "明细查看(取消上报数)";
                  break;
              case "back_count":
                  this.detailObj.detailtitle = "明细查看(召回数)";
                  break;
              case "rep_timely_count":
                  this.detailObj.detailtitle = "明细查看(上报及时数)";
                  break;
              case "rep_untimely_count":
                  this.detailObj.detailtitle = "明细查看(上报不及时数)";
                  break;
              case "confirm_count":
                  this.detailObj.detailtitle = "明细查看(确认数)";
                  break;
              case "unconfirm_count":
                  this.detailObj.detailtitle = "明细查看(未确认数)";
                  break;
              case "deal_count":
                  this.detailObj.detailtitle = "明细查看(处理数)";
                  break;
              case "undeal_count":
                  this.detailObj.detailtitle = "明细查看(未处理数)";
                  break;
              default:
                  break;
          }
          this.getDetailData(column.property, row);
      },
      getDetailData(flag, row) {
          this.detailObj.dialogdetail = true;
          this.detailObj.dxloading = true;
          this.$tool
              .request({
                  url: "LIS/LIS6/LIS642",
                  method: "post",
                  data: {
                      action: "getDetailData",
                      flag: flag,
                      selrow: row,
                      startdate: this.search_startdate, //上报开始日期
                      enddate: this.search_enddate, //上报结束日期
                      sample_startdt: this.sample_startdt,
                      sample_enddt: this.sample_enddt,
                      daytype: this.daytype,
                      labdeptval: this.search_labdeptval, // 检验科室
                      alertkind: this.search_alertkind, // 危急值分类
                      deptcode: this.search_deptcode, //科室
                      islabbill: this.search_islabbill == true ? "1" : "0", //剔除实验室开单
                      rptunit: this.search_rptunit, // 报告单元
                      labgroupid: this.search_labgroupid, // 检验组
                      wardno: this.search_wardno, // 病区
                      pattype: this.search_pattype, // 病人类型
                      isreject: this.search_isreject == true ? "1" : "0", // 剔除
                      isbarcodenull: this.search_isbarcodenull == true ? "1" : "0", // 剔除无条码数据
                      sendhospcode: this.search_sendhospcode, // 送检医院
                      rpt_itemcode: this.search_rpt_itemcode, // 报告项目
                      unitgroup: this.search_unitgroup, // 单元组合
                      chkhospcode: this.search_chkhospcode, // 检验医院
                      ispatcodenull: this.search_ispatcodenull == true ? "1" : "0", // 剔除 无病人号
                      alerttype: this.search_alerttype, // 警告类别
                      sendminute: this.search_sendminute, // 上报超过
                      dealminute: this.search_dealminute, // 处理超过
                      phoneminute: this.search_phoneminute, // 电话通知超过
                      iswaitsearch: this.search_iswaitsearch == true ? "1" : "0", // 剔除有待查原因的数据
                      isinsidetime: this.search_isinsidetime == true ? "1" : "0", // 使用内部处理时间
                      confirmminute: this.search_confirmminute, // 确认超过
                      reviewminute: this.search_reviewminute, // 复查超过
                      insideminute: this.search_insideminute, // 内部处理超过
                      isuserconfirmtime: this.search_isuserconfirmtime == true ? "1" : "0", // 无处理时间使用确认时间
                      isreportcount: this.search_isreportcount == true ? "1" : "0", // 统计上报数
                      isshowreport: this.search_isshowreport == true ? "1" : "0", //显示危急值报告数据
                      isuserdealtime: this.search_isuserdealtime == true ? "1" : "0", // 无确认时间使用处理时间
                      infocode: this.infocode, //要查询的列数
                      infoitem: this.infoitem,
                  },
              })
              .then((res) => {
                  this.detailObj.dialogdetail = true;
                  this.detailObj.dxloading = false;
                  this.detailObj.popTableData = res.data;
              })
              .catch((e) => {
                  this.$alert(e, "出错");
                  this.detailObj.dxloading = false;
              });
      },
      PopCellClassName() {},
      popMultipleChk(e, fieldname, option, title) {
          let temp = XEUtils.clone(option, true);
          this.option1 = [];
          this.option2 = [];
          if (e != "") {
              let k = e.split(",");
              k.forEach((item) => {
                  let ndata = temp.find((m) => m.data == item);
                  if (ndata != undefined && ndata != null) {
                      this.option2.push(ndata);
                  }
              });
              temp.forEach((item) => {
                  if (k.indexOf(item.data + "") < 0) {
                      this.option1.push(item);
                  }
              });
          } else {
              this.option1 = temp;
          }
          this.fieldname = fieldname;
          this.multichktitle = title;
          this.dialogMultipleVisible = true;
      },
      closedialog(value, name) {
          if (value != "close") {
              this[name] = value;
          }
          this.dialogMultipleVisible = false;
      },

      async initOption() {
          try {
              const res = await this.$tool.request({
                  url: "LIS/LIS6/LIS642",
                  method: "post",
                  data: {
                      action: "initOption",
                  },
              });

              this.pattypeOption = res.pattypeOption;
              this.labdeptOption = res.labdeptOption;
              this.rptunitOption = res.rptunitOption;
              this.labgroupOption = res.labgroupOption;
              this.rptunitGroupOption = res.rptunitGroupOption;
              this.hospOption = res.hospOption;
              this.docOption = res.docOption;
              this.deptOption = res.deptOption;
              this.wardOption = res.wardOption;
          } catch (e) {
              this.$message.warning(e);
          }
      },
      BtnQuery() {
          this.InitPage();
      },

      BtnClear() {
          this.search_labdeptval = ""; // 检验科室
          this.search_alertkind = ""; // 危急值分类
          this.search_deptcode = ""; //科室
          this.search_islabbill = false; //剔除实验室开单
          this.search_rptunit = ""; // 报告单元
          this.search_labgroupid = ""; // 检验组
          this.search_wardno = ""; // 病区
          this.search_pattype = ""; // 病人类型
          this.search_isreject = false; // 剔除
          this.search_isbarcodenull = false; // 剔除无条码数据
          this.search_sendhospcode = ""; // 送检医院
          this.search_rpt_itemcode = ""; // 报告项目
          this.search_unitgroup = ""; // 单元组合
          this.search_chkhospcode = ""; // 检验医院
          this.search_ispatcodenull = false; // 剔除 无病人号
          this.search_alerttype = ""; // 警告类别
          this.search_sendminute = ""; // 上报超过
          this.search_dealminute = ""; // 处理超过
          this.search_phoneminute = ""; // 电话通知超过
          this.search_iswaitsearch = false; // 剔除有待查原因的数据
          this.search_isinsidetime = false; // 使用内部处理时间
          this.search_confirmminute = ""; // 确认超过
          this.search_reviewminute = ""; // 复查超过
          this.search_insideminute = ""; // 内部处理超过
          this.search_isuserconfirmtime = false; // 无处理时间使用确认时间
          this.search_isreportcount = false; // 统计上报数
          this.search_isshowreport = false; // 显示危急值报告数据
          this.search_isuserdealtime = false; // 无确认时间使用处理时间

          this.infoitem = "";
          this.infocode = "";
          this.tableData = [];
          this.chklist = {
              chk_req_deptno: false, // 科室(申请科室)
              chk_alerttype: false, // 警告类别
              chk_sendhospcode: false, // 送检医院
              chk_years: false, // 年
              chk_req_wardno: false, // 病区
              chk_report_user: false, // 检验医生
              chk_ckhospcode: false, // 检验医院
              chk_months: false, // 月
              chk_emerflagname: false, // *急诊
              chk_req_docno: false, // 送检医生
              chk_labgroupid: false, // 检验组
              chk_rpt_itemname: false, // 项目
              chk_pat_typecode: false, // 病人类型
              chk_rptunitid: false, // 报告单元
              chk_alertman: false, // 上报人
              chk_alertkind: false, // 危急值分类
          };
          this.chkcnt = 0;
      },
      chkevent(e, code, name) {
          if (e == "1") {
              if (this.chkcnt <= 7) {
                  this.chkcnt++;
                  if (this.infocode.indexOf(code) == -1) {
                      this.infocode += code + ",";
                      this.infoitem += name + ",";
                  }
              } else {
                  this.$alert("不能选择更多的分组！", "提示");
                  this.chklist[code] = false;
                  //console.log(this, this[code]);
              }
          } else {
              if (this.infocode.indexOf(code) > -1) {
                  this.chkcnt--;
                  this.infocode = this.infocode.replace(code, "");
                  this.infoitem = this.infoitem.replace(name, "");
              }
          }
      },

      async InitPage() {
          try {
              if (this.chkcnt < 1) {
                  this.$alert("请勾选右边分组条件！", "信息");
                  return false;
              }
              this.xTableLoading = true;
              const response = await this.$tool.request({
                  url: "LIS/LIS6/LIS642",
                  method: "post",
                  timeout: 600000,
                  data: {
                      action: "queryData",
                      startdate: this.search_startdate, //上报开始日期
                      enddate: this.search_enddate, //上报结束日期
                      daytype: this.daytype,
                      sample_startdt: this.sample_startdt,
                      sample_enddt: this.sample_enddt,
                      labdeptval: this.search_labdeptval, // 检验科室
                      alertkind: this.search_alertkind, // 危急值分类
                      deptcode: this.search_deptcode, //科室
                      islabbill: this.search_islabbill == true ? "1" : "0", //剔除实验室开单
                      rptunit: this.search_rptunit, // 报告单元
                      labgroupid: this.search_labgroupid, // 检验组
                      wardno: this.search_wardno, // 病区
                      pattype: this.search_pattype, // 病人类型
                      isreject: this.search_isreject == true ? "1" : "0", // 剔除
                      isbarcodenull: this.search_isbarcodenull == true ? "1" : "0", // 剔除无条码数据
                      sendhospcode: this.search_sendhospcode, // 送检医院
                      rpt_itemcode: this.search_rpt_itemcode, // 报告项目
                      unitgroup: this.search_unitgroup, // 单元组合
                      chkhospcode: this.search_chkhospcode, // 检验医院
                      ispatcodenull: this.search_ispatcodenull == true ? "1" : "0", // 剔除 无病人号
                      alerttype: this.search_alerttype, // 警告类别
                      sendminute: this.search_sendminute, // 上报超过
                      dealminute: this.search_dealminute, // 处理超过
                      phoneminute: this.search_phoneminute, // 电话通知超过
                      iswaitsearch: this.search_iswaitsearch == true ? "1" : "0", // 剔除有待查原因的数据
                      isinsidetime: this.search_isinsidetime == true ? "1" : "0", // 使用内部处理时间
                      confirmminute: this.search_confirmminute, // 确认超过
                      reviewminute: this.search_reviewminute, // 复查超过
                      insideminute: this.search_insideminute, // 内部处理超过
                      isuserconfirmtime: this.search_isuserconfirmtime == true ? "1" : "0", // 无处理时间使用确认时间
                      isreportcount: this.search_isreportcount == true ? "1" : "0", // 统计上报数
                      isshowreport: this.search_isshowreport == true ? "1" : "0", //显示危急值报告数据
                      isuserdealtime: this.search_isuserdealtime == true ? "1" : "0", // 无确认时间使用处理时间
                      infocode: this.infocode, //要查询的列数
                      infoitem: this.infoitem,
                  },
              });
              if (!!response.RData.Data) {
                  this.tableColumn = response.RData.Cols;
                  this.tableData = response.RData.Data;
                  this.xTableLoading = false;
              } else {
                  // this.InitPage();
                  this.$message.warning("查询超时,可以尝试缩短签收日期或减少分组条件！");
                  this.xTableLoading = false;
              }
          } catch (e) {
              this.xTableLoading = false;
              this.$alert(e, "消息");
          }
      },
      formatFun({ cellValue, column, row }) {
          return this.retForamtVal(cellValue, column.property);
      },
      retForamtVal(cellValue, column) {
          if (column == "pat_typecode") {
              // 病人类型
              try {
                  let pattypename = this.pattypeOption.find((m) => m.data == cellValue);
                  if (pattypename != undefined && pattypename != null) {
                      return pattypename.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "req_deptno") {
              // 科室
              try {
                  let reqdept = this.deptOption.find((m) => m.data == cellValue);
                  if (reqdept != undefined && reqdept != null) {
                      return reqdept.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "alerttype") {
              // 科室
              try {
                  if (cellValue == "0") {
                      return "危急值";
                  } else if (cellValue == "1") {
                      return "多重耐药菌";
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "labgroupid") {
              //检验工作组
              try {
                  let labgroup = this.labgroupOption.find((m) => m.data == cellValue);
                  if (labgroup != undefined && labgroup != null) {
                      return labgroup.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "rptunitid") {
              // 报告单元
              try {
                  let labgroup = this.rptunitOption.find((m) => m.data == cellValue);
                  if (labgroup != undefined && labgroup != null) {
                      return labgroup.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "ckhospcode") {
              // 检验院区
              try {
                  let hospital = this.hospOption.find((m) => m.data == cellValue);
                  if (hospital != undefined && hospital != null) {
                      return hospital.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "sendhospcode") {
              // 检验院区
              try {
                  let hospital = this.hospOption.find((m) => m.data == cellValue);
                  if (hospital != undefined && hospital != null) {
                      return hospital.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "req_wardno") {
              // 病区
              try {
                  let ward = this.wardOption.find((m) => m.data == cellValue);
                  if (ward != undefined && ward != null) {
                      return ward.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "report_user") {
              // 检验医生
              try {
                  let reportuser = this.docOption.find((m) => m.data == cellValue);
                  if (reportuser != undefined && reportuser != null) {
                      return reportuser.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          }else if (column == "req_docno") {
              // 送检医生
              try {
                  let reqdocno = this.docOption.find((m) => m.data == cellValue);
                  if (reqdocno != undefined && reqdocno != null) {
                      return reqdocno.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } 
          else if (column == "alertman") {
              // 上报人
              try {
                  let alertman = this.docOption.find((m) => m.data == cellValue);
                  if (alertman != undefined && alertman != null) {
                      return alertman.display;
                  } else {
                      return cellValue;
                  }
              } catch {
                  return cellValue;
              }
          } else if (column == "result_flag") {
              switch (cellValue) {
                  case "M":
                      return "正常";
                  case "H":
                      return "偏高";
                  case "L":
                      return "偏低";
                  case "P":
                      return "阳性";
                  case "W":
                      return "弱阳性";
                  case "E":
                      return "错误";
                  case "Q":
                      return "非敏感";
                  default:
                      return cellValue;
              }
          } else {
              return cellValue;
          }
      },
      footerCellClassName({ $rowIndex, column, columnIndex }) {
          if (columnIndex === 0 || ["total_count", "uncheck_count", "uncheck_rate"].includes(column.property)) {
              if ($rowIndex === 0) {
                  return "col-blue";
              } else {
                  return "col-red";
              }
          }
      },

      footerMethod({ columns, data }) {
          return [
              columns.map((column, columnIndex) => {
                  if (columnIndex === 0) {
                      return "总计";
                  }
                  if (["repedreport_count", "chkreport_count", "chkrepedreport_count","total_count", "reped_count", "cancel_count", "back_count", "rep_timely_count", "rep_untimely_count", "confirm_count", "unconfirm_count", "confirm_ok_count", "deal_count", "undeal_count", "deal_ok_count", "inconfirm_ok_count", "review_ok_count", "review_count", "height_count", "low_count", "report_count"].includes(column.property)) {
                      return XEUtils.sum(data, column.property);
                  }

                  if (["reped_rate"].includes(column.property)) {
                      if (this.search_isreportcount == "1") {
                          if (this.tableData.length > 0) {
                              return Number(((this.SumAll(this.tableData, "reped_count") + this.SumAll(this.tableData, "cancel_count") + this.SumAll(this.tableData, "back_count")) / this.SumAll(this.tableData, "total_count")) * 100).toFixed(2) + "%";
                          } else {
                              return "0%";
                          }
                      } else {
                          if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "reped_count") / this.SumAll(this.tableData, "total_count")) * 100).toFixed(2) + "%";
                          else return "0%";
                      }
                  }

                  if (["back_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "back_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  if (["rep_timely_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "rep_timely_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  if (["confirm_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "confirm_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  if (["confirm_ok_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "confirm_ok_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  if (["deal_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "deal_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  if (["deal_ok_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "deal_ok_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  if (["inconfirm_ok_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "inconfirm_ok_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  if (["review_ok_rate"].includes(column.property)) {
                      if (this.tableData.length > 0) return Number((this.SumAll(this.tableData, "review_ok_count") / this.SumAll(this.tableData, "review_count")) * 100).toFixed(2) + "%";
                      else return "0%";
                  }

                  return null;
              }),
          ];
      },

      SumAll(data, property) {
          var plus = 0;
          if (data) {
              for (let i = 0, len = data.length; i < len; i++) {
                  plus += data[i][property] - 0;
              }
          }

          return plus;
      },
      labdeptChange(code, name) {
          this.search_labdeptval = code;
          this.labdeptname = name;
      },
      deptChange(code, name) {
          this.search_deptcode = code;
          this.deptname = name;
      },
      rptunitChange(code, name) {
          this.search_rptunit = code;
          this.rptunitname = name;
      },
      labgroupChange(code, name) {
          this.search_labgroupid = code;
          this.labgroupname = name;
      },
      wardChange(code, name) {
          this.search_wardno = code;
          this.wardname = name;
      },
      pattypeChange(code, name) {
          this.search_pattype = code;
          this.pattypename = name;
      },
      sendhospChange(code, name) {
          this.search_sendhospcode = code;
          this.sendhospname = name;
      },
      rptitemChange(code, name) {
          this.search_rpt_itemcode = code;
          this.rptitemname = name;
      },
      chkhospChange(code, name) {
          this.search_chkhospcode = code;
          this.chkhospname = name;
      },
      //导出
      BtnExport() {
          let data = this.getExportData();
          let filtertxt = this.getExportFilter();
          this.$pub.exportTableExcelWithData(data, this.exportTableColLen, "LIS642 危急值上报、确认、处理统计.xlsx", filtertxt, "统计条件：");
      },
      // 获取当前导出文件的所有查询条件
      getExportFilter() {
          let filtertxt = this.datename + ":" + XEUtils.toDateString(this.daytype == "1" ? this.search_startdate : this.sample_startdt, "yyyy-MM-dd") + "至" + XEUtils.toDateString(this.daytype == "1" ? this.search_enddate : this.sample_enddt, "yyyy-MM-dd") + "; ";
          if (this.search_labdeptval) filtertxt += "检验科室:" + this.labdeptname + "; ";
          if (this.search_alertkind) filtertxt += "危急值分类:" + this.getOptionName(this.alertkind.filter((item) => ("," + this.search_alertkind + ",").indexOf("," + item.data + ",") > -1)) + "; ";
          if (this.search_deptcode) filtertxt += "科室:" + this.deptname + "; ";
          if (this.search_rptunit) filtertxt += "报告单元:" + this.rptunitname + "; ";
          if (this.search_labgroupid) filtertxt += "检验组:" + this.labgroupname + "; ";
          if (this.search_wardno) filtertxt += "病区:" + this.wardname + "; ";
          if (this.search_pattype) filtertxt += "病人类型:" + this.pattypename + "; ";
          if (this.search_sendhospcode) filtertxt += "送检医院:" + this.sendhospname + "; ";
          if (this.search_rpt_itemcode) filtertxt += "报告项目:" + this.rptitemname + "; ";
          if (this.search_unitgroup) filtertxt += "单元组合:" + this.getOptionName(this.rptunitGroupOption.filter((item) => ("," + this.search_unitgroup + ",").indexOf("," + item.data + ",") > -1)) + "; ";
          if (this.search_chkhospcode) filtertxt += "检验医院:" + this.chkhospname + "; ";
          if (this.search_islabbill == "1") filtertxt += "剔除实验室开单; ";
          if (this.search_isbarcodenull == "1") filtertxt += "剔除无条码数据; ";
          if (this.search_ispatcodenull == "1") filtertxt += "剔除无病人号; ";
          filtertxt += "警告类别:" + (this.search_alerttype == "0" ? "危急值" : this.search_alerttype == "1" ? "多重耐药菌" : this.search_alerttype == "2" ? "血培养阳性" : "全部") + "; ";
          if (this.search_isreportcount == "1") filtertxt += "统计上报率时召回数和取消上报数亦视为已上报数; ";
          if (this.search_isshowreport == "1") filtertxt += "显示危急值报告数据; ";
          if (this.search_sendminute) filtertxt += "上报超过" + this.search_sendminute + "分钟; ";
          if (this.search_dealminute) filtertxt += "处理超过" + this.search_dealminute + "分钟; ";
          if (this.search_insideminute) filtertxt += "内部处理超过" + this.search_insideminute + "分钟; ";
          if (this.search_confirmminute) filtertxt += "确认超过" + this.search_confirmminute + "分钟; ";
          if (this.search_reviewminute) filtertxt += "复查超过" + this.search_reviewminute + "分钟; ";
          if (this.search_isuserdealtime == "1") filtertxt += "无确认时间使用处理时间; ";
          if (this.search_isuserconfirmtime == "1") filtertxt += "无处理时间使用确认时间; ";
          let tatcoltxt = "";
          if (this.chklist.chk_req_deptno == "1") tatcoltxt += "科室、";
          if (this.chklist.chk_alerttype == "1") tatcoltxt += "警告类别、";
          if (this.chklist.chk_sendhospcode == "1") tatcoltxt += "送检医院、";
          if (this.chklist.chk_req_wardno == "1") tatcoltxt += "病区、";
          if (this.chklist.chk_report_user == "1") tatcoltxt += "检验医生、";
          if (this.chklist.chk_ckhospcode == "1") tatcoltxt += "检验院区、";
          if (this.chklist.chk_emerflagname == "1") tatcoltxt += "急诊、";
          if (this.chklist.chk_req_docno == "1") tatcoltxt += "送检医生、";
          if (this.chklist.chk_labgroupid == "1") tatcoltxt += "检验组、";
          if (this.chklist.chk_rpt_itemname == "1") tatcoltxt += "项目、";
          if (this.chklist.chk_pat_typecode == "1") tatcoltxt += "病人类型、";
          if (this.chklist.chk_rptunitid == "1") tatcoltxt += "报告单元、";
          if (this.chklist.chk_alertman == "1") tatcoltxt += "上报人、";
          if (this.chklist.chk_alertkind == "1") tatcoltxt += "危急值分类、";
          if (this.chklist.chk_years == "1") tatcoltxt += "年、";
          if (this.chklist.chk_months == "1") tatcoltxt += "月、";
          if (tatcoltxt) filtertxt += "统计项目:" + tatcoltxt.substring(0, tatcoltxt.length - 1) + "; ";
          return filtertxt;
      },
      getOptionName(option) {
          if (option && option.length > 0) {
              let optionname = "";
              option.forEach((item) => {
                  if (item.hasOwnProperty("display")) {
                      optionname += item.display + ",";
                  } else {
                      optionname += item.label + ",";
                  }
              });
              return optionname.substring(0, optionname.length - 1);
          } else {
              return "";
          }
      },
      getExportData() {
          let datas = this.$refs.xTable.afterFullData;
          let exportColumn = XEUtils.clone(this.tableColumn, true);
          if(this.search_isshowreport == "1") {
              exportColumn.push({ title: "危急值报告总数", field: "report_count" });
              exportColumn.push({ title: "危急值报告通报数", field: "repedreport_count" });
              exportColumn.push({ title: "已审核危急值报告总数", field: "chkreport_count" });
              exportColumn.push({ title: "已审核危急值报告通报数", field: "chkrepedreport_count" });
          }
          exportColumn.push({ title: "总数", field: "total_count" });
          exportColumn.push({ title: "上报数", field: "reped_count" });
          exportColumn.push({ title: "上报率", field: "reped_rate" });
          exportColumn.push({ title: "取消上报数", field: "cancel_count" });
          exportColumn.push({ title: "召回数", field: "back_count" });
          exportColumn.push({ title: "召回率", field: "back_rate" });
          exportColumn.push({ title: "上报及时数", field: "rep_timely_count" });
          exportColumn.push({ title: "上报不及时数", field: "rep_untimely_count" });
          exportColumn.push({ title: "上报及时率", field: "rep_timely_rate" });
          exportColumn.push({ title: "确认数", field: "confirm_count" });
          exportColumn.push({ title: "未确认数", field: "unconfirm_count" });
          exportColumn.push({ title: "确认率", field: "confirm_rate" });
          exportColumn.push({ title: "确认合格数", field: "confirm_ok_count" });
          exportColumn.push({ title: "确认合格率", field: "confirm_ok_rate" });
          exportColumn.push({ title: "处理数", field: "deal_count" });
          exportColumn.push({ title: "未处理数", field: "undeal_count" });
          exportColumn.push({ title: "处理率", field: "deal_rate" });
          exportColumn.push({ title: "处理合格数", field: "deal_ok_count" });
          exportColumn.push({ title: "处理合格率", field: "deal_ok_rate" });
          exportColumn.push({ title: "内部确认及时数", field: "inconfirm_ok_count" });
          exportColumn.push({ title: "内部确认及时率", field: "inconfirm_ok_rate" });
          exportColumn.push({ title: "复查结果及时数", field: "review_ok_count" });
          exportColumn.push({ title: "复查数", field: "review_count" });
          exportColumn.push({ title: "复查及时率", field: "review_ok_rate" });
          exportColumn.push({ title: "高值项次", field: "height_count" });
          exportColumn.push({ title: "低值项次", field: "low_count" });
          exportColumn.push({ title: "占报告数", field: "report_count" });
          exportColumn.push({ title: "结果时间中位数", field: "median" });
          exportColumn.push({ title: "结果时间90分位数", field: "median90" });
          this.exportTableColLen = exportColumn.length;
          let columns = exportColumn.filter((item) => item.field);
          let footerData = {};
          columns.forEach((item, index) => {
              if (index === 0) {
                  footerData[item.field] = "总计";
              }
              if (["repedreport_count", "chkreport_count", "chkrepedreport_count","total_count", "reped_count", "cancel_count", "back_count", "rep_timely_count", "rep_untimely_count", "confirm_count", "unconfirm_count", "confirm_ok_count", "deal_count", "undeal_count", "deal_ok_count", "inconfirm_ok_count", "review_ok_count", "review_count", "height_count", "low_count", "report_count"].includes(item.field)) {
                  footerData[item.field] = XEUtils.sum(datas, item.field);
              }

              // if (["uncheck_rate"].includes(item.field)) {
              //     if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "uncheck_count") / this.SumAll(this.tableData, "total_count")) * 100).toFixed(2) + "%";
              //     else footerData[item.field] = "0%";
              // }

              if (["reped_rate"].includes(item.field)) {
                  if (this.search_isreportcount == "1") {
                      if (this.tableData.length > 0) {
                          footerData[item.field] = Number(((this.SumAll(this.tableData, "reped_count") + this.SumAll(this.tableData, "cancel_count") + this.SumAll(this.tableData, "back_count")) / this.SumAll(this.tableData, "total_count")) * 100).toFixed(2) + "%";
                      } else {
                          footerData[item.field] = "0%";
                      }
                  } else {
                      if (this.tableData.length > 0) footerData[item.field] = footerData[item.field] = Number((this.SumAll(this.tableData, "reped_count") / this.SumAll(this.tableData, "total_count")) * 100).toFixed(2) + "%";
                      else footerData[item.field] = "0%";
                  }
              }

              if (["back_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "back_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }

              if (["rep_timely_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "rep_timely_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }

              if (["confirm_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "confirm_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }

              if (["confirm_ok_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "confirm_ok_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }

              if (["deal_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "deal_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }

              if (["deal_ok_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "deal_ok_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }

              if (["inconfirm_ok_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "inconfirm_ok_count") / this.SumAll(this.tableData, "reped_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }

              if (["review_ok_rate"].includes(item.field)) {
                  if (this.tableData.length > 0) footerData[item.field] = Number((this.SumAll(this.tableData, "review_ok_count") / this.SumAll(this.tableData, "review_count")) * 100).toFixed(2) + "%";
                  else footerData[item.field] = "0%";
              }
          });
          datas.splice(datas.length, 0, footerData);
          let headers = [columns.map((item) => item.title)];
          return headers.concat(
              datas.map((row) => {
                  return columns.map((column) => {
                      return this.retForamtVal(row[column.field], column.field);
                  });
              })
          );
      },
      toBuffer(wbout) {
          let buf = new ArrayBuffer(wbout.length);
          let view = new Uint8Array(buf);
          for (let index = 0; index !== wbout.length; ++index) view[index] = wbout.charCodeAt(index) & 0xff;
          return buf;
      },
  },
};
</Script>

<style scoped>
.pagetop {
  width: 100%;
  display: -webkit-box;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  border: solid 1px #ccc;
  position: absolute;
  z-index: 99;
  /* height: 250px;*/
  overflow-x: auto;
  overflow-x: overlay;
}

.pagecenter {
  position: absolute;
  top: 225px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
}

.middle-center {
  position: absolute;
  height: 100%;
  left: 0px;
  right: 0px;
  overflow: auto;
}

.el-checkbox__label {
  padding: 0px;
}

.tdpadding {
  padding-left: 10px !important;
}

.left_nav {
  width: 20%;
  height: 100%;
  border-right: 1px solid #ccc;
  padding: 0px 0px 0px 0px;
  float: left;
  display: inline;
}

.left_nav div {
  cursor: pointer;
  height: 40px;
  width: 100%;
  float: left;
  padding-left: 20px;
  line-height: 40px;
}

.left_nav .active {
  background-color: DeepSkyBlue;
}

.divwidth {
  width: 50px !important;
  height: 26px !important;
}

.right_nav {
  width: 80%;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  float: left;
  display: inline;
}

table {
  font-size: 12px;
  border-collapse: separate;
  border-spacing: 5px;
}

.table1style tr td {
  padding: 0px 0px 0px 0px;
}

/deep/ .mytable-style .vxe-footer--column.col-blue {
  color: blue !important;
  font-weight: bold;
}

/deep/ .mytable-style .vxe-body--row.row-blue {
  color: blue !important;
  font-weight: bold;
}

/deep/ .el-icon-time {
  line-height: 18px !important;
}

/deep/ .el-range__close-icon {
  line-height: 18px !important;
}

/deep/ .el-range-editor--small .el-range-separator {
  line-height: 17px !important;
}

/deep/ .mychkclass .el-checkbox {
  margin-right: 15px;
}

.operation-list {
  float: right;
  margin-right: 5px;
  margin-bottom: 5px;
}

::-webkit-scrollbar {
  width: 0px;
  height: 5px;
  border: 4px solid white;
}

::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
}

::-webkit-scrollbar-track {
  background-color: #f1f1f1;
}

/* Buttons */
::-webkit-scrollbar-button:single-button {
  background-color: #bbbbbb;
  display: block;
  border-style: solid;
  height: 5px;
  width: 5px;
}

/* Left */
::-webkit-scrollbar-button:horizontal:decrement {
  margin-right: 2px;
  border-width: 4px 4px 4px 0;
  border-color: #f1f1f1 transparent #f1f1f1 #f1f1f1;
  background-color: #000000;
}

::-webkit-scrollbar-button:horizontal:decrement:hover {
  border-color: #d2d2d2 transparent #d2d2d2 #d2d2d2;
}

/* Right */
::-webkit-scrollbar-button:horizontal:increment {
  margin-left: 2px;
  border-width: 4px 0 4px 4px;
  border-color: #f1f1f1 #f1f1f1 #f1f1f1 transparent;
  background-color: #000000;
}

::-webkit-scrollbar-button:horizontal:increment:hover {
  border-color: #d2d2d2 #d2d2d2 #d2d2d2 transparent;
}
</style>